#include "AnalogSensor.h"

/*! \brief Creates a new instance of an Analog Sensor
 *
 * @param adc
 * @param channel
 */
AnalogSensor::AnalogSensor(IAnalogDigitalConverter *adc, UINT32 channel)
{
	this->_adc = adc;
	this->_channel = channel;
}

/*! \brief Default Destructor
 */
AnalogSensor::~AnalogSensor()
{

}

/*! \brief Reads the current value from the ADC device
 */
void AnalogSensor::UpdateValue()
{
	this->_value = this->_adc->Read(this->_channel);
}

/*! \brief Returns the last read value (from UpdateValue)
 *
 * @returns Last read value.
 */
float AnalogSensor::GetValue()
{
	return this->_value;
}
